package com.design.chain;

/**
 * @author cxx
 * @create 2020-04-21 14:56
 **/
public abstract class AbstractInterceptor implements Interceptor {

    protected Interceptor nextInterceptor;

    protected String request;

    public AbstractInterceptor(Interceptor nextInterceptor) {
        this.nextInterceptor = nextInterceptor;
    }

    @Override
    public void handle(String request) {
        print(request);
        if(nextInterceptor != null){
            nextInterceptor.handle (request);
        }
    }

    protected abstract void print(String request);

}
